<?php

namespace app\controller;

use think\facade\Request;
use app\BaseController;
use app\ResourceModel;
use app\controller\ResourceController;
use think\facade\Db;

class ResourceImportController extends ResourceController
{
    //工程项目和购置类资金表
    public function projectBiao($dataList)
    {
        $data = [];
        $userInfo = getLoginInfo();
        foreach ($dataList as $key => $val) {
            $data[] = ['units' => $val['units'],
                'units_name' => $val['units_name'],
                'fund_type' => $val['fund_type'],
                'project_name' => $val['project_name'],
                'voucher_date' => $val['voucher_date'],
                'voucher_number' => $val['voucher_number'],
                'payment_digest' => $val['payment_digest'],
                'payment_money' => $val['payment_money'],
                'pay_type' => $val['pay_type'],
                'bf_gist' => $val['bf_gist'],
                'cgzb' => $val['cgzb'],
                'cgzb_number' => empty($val['cgzb_number']) ? '' : $val['cgzb_number'],
                'receipt_units_name' => $val['receipt_units_name'],
                'receipt_units_number' => $val['receipt_units_number'],
                'receipt_units_bank' => $val['receipt_units_bank'],
                'note_type' => $val['note_type'],
                'note_number' => empty($val['note_number']) ? '' : $val['note_number'],
                'open' => $val['open'],
                'gist' => empty($val['gist']) ? '' : $val['gist'],
                'remarks' => empty($val['remarks']) ? '' : $val['remarks'],
                'create_time' => toDate(time()),
                'create_by' => $userInfo['id']
            ];
        }
        return Db::table('shenbei_fund_project')->insertAll($data);
    }

    //对外补贴类资金总表
    public function subsidyGeneralTable($dataList)
    {
        $data = [];
        $userInfo = getLoginInfo();
        foreach ($dataList as $key => $val) {
            $data[] = ['units' => $val['units'],
                'units_name' => $val['units_name'],
                'fund_type' => $val['fund_type'],
                'subsidy_name' => $val['subsidy_name'],
                'detail_id' => $val['detail_id'],
                'voucher_date' => $val['voucher_date'],
                'voucher_number' => $val['voucher_number'],
                'payment_digest' => $val['payment_digest'],
                'payment_money' => $val['payment_money'],
                'pay_type' => $val['pay_type'],
                'bf_gist' => $val['bf_gist'],
                'policy_gist' => $val['policy_gist'],
                'grant_object_type' => $val['grant_object_type'],
                'grant_standard' => empty($val['grant_standard']) ? '' : $val['grant_standard'],
                'open' => $val['open'],
                'gist' => empty($val['gist']) ? '' : $val['gist'],
                'remarks' => empty($val['remarks']) ? '' : $val['remarks'],
                'create_time' => toDate(time()),
                'create_by' => $userInfo['id']
            ];
        }
        return Db::table('shenbei_fund_subsidy')->insertAll($data);
    }

    //对外补贴类资金明细表
    public function subsidyDetailedTable($dataList)
    {
        $data = [];
        $userInfo = getLoginInfo();
        foreach ($dataList as $key => $val) {
            $data[] = ['units' => $val['units'],
                'units_name' => $val['units_name'],
                'fund_type' => $val['fund_type'],
                'subsidy_name' => $val['subsidy_name'],
                'detail_id' => $val['detail_id'],
                'voucher_date' => $val['voucher_date'],
                'voucher_number' => $val['voucher_number'],
                'grant_date' => $val['grant_date'],
                'grant_money' => $val['grant_money'],
                'grant_type' => $val['grant_type'],
                'street' => empty($val['street']) ? '' : $val['street'],
                'community' => empty($val['community']) ? '' : $val['community'],
                'grant_object' => $val['grant_object'],
                'certificate_number' => $val['certificate_number'],
                'bank_number' => $val['bank_number'],
                'open' => $val['open'],
                'gist' => empty($val['gist']) ? '' : $val['gist'],
                'remarks' => empty($val['remarks']) ? '' : $val['remarks'],
                'create_time' => toDate(time()),
                'create_by' => $userInfo['id']
            ];
        }
        return Db::table('shenbei_fund_subsidy_detail')->insertAll($data);
    }

    //项目基本信息表
    public function projectBasicsTable($dataList)
    {
        $data = [];
        $userInfo = getLoginInfo();
        foreach ($dataList as $key => $val) {
            $data[] = ['units' => $val['units'],
                'project_name' => $val['project_name'],
                'purchase_type' => $val['purchase_type'],
                'project_number' => empty($val['project_number']) ? '' : $val['project_number'],
                'project_zb_number' => empty($val['project_zb_number']) ? '' : $val['project_zb_number'],
                'section_name' => empty($val['section_name']) ? '' : $val['section_name'],
                'project_zb_section_number' => empty($val['project_zb_section_number']) ? '' : $val['project_zb_section_number'],
                'project_site' => empty($val['project_site']) ? '' : $val['project_site'],
                'project_content' => empty($val['project_content']) ? '' : $val['project_content'],
                'cg_approval_time' => $val['cg_approval_time'],
                'cg_approval_number' => empty($val['cg_approval_number']) ? '' : $val['cg_approval_number'],
                'cg_units_name' => empty($val['cg_units_name']) ? '' : $val['cg_units_name'],
                'cg_units_id' => empty($val['cg_units_id']) ? '' : $val['cg_units_id'],
                'cg_units_principal_name' => empty($val['cg_units_principal_name']) ? '' : $val['cg_units_principal_name'],
                'cg_units_principal_idcard' => $val['cg_units_principal_idcard'],
                'cg_dl_units_name' => empty($val['cg_dl_units_name']) ? '' : $val['cg_dl_units_name'],
                'cg_dl_units_id' => empty($val['cg_dl_units_id']) ? '' : $val['cg_dl_units_id'],
                'cg_dl_units_principal_name' => empty($val['cg_dl_units_principal_name']) ? '' : $val['cg_dl_units_principal_name'],
                'cg_dl_units_principal_idcard' => $val['cg_dl_units_principal_idcard'],
                'cg_budget' => empty($val['cg_budget']) ? '' : $val['cg_budget'],
                'zb_units_name' => empty($val['zb_units_name']) ? '' : $val['zb_units_name'],
                'zb_units_id' => empty($val['zb_units_id']) ? '' : $val['zb_units_id'],
                'zb_money' => empty($val['zb_money']) ? '' : $val['zb_money'],
                'contract_money' => empty($val['contract_money']) ? '' : $val['contract_money'],
                'zb_units_legal_name' => empty($val['zb_units_legal_name']) ? '' : $val['zb_units_legal_name'],
                'zb_units_legal_idcard' => $val['zb_units_legal_idcard'],
                'zb_units_principal_name' => empty($val['zb_units_principal_name']) ? '' : $val['zb_units_principal_name'],
                'zb_units_principal_idcard' => $val['zb_units_principal_idcard'],
                'open' => $val['open'],
                'gist' => empty($val['gist']) ? '' : $val['gist'],
                'remarks' => empty($val['remarks']) ? '' : $val['remarks'],
                'create_time' => toDate(time()),
                'create_by' => $userInfo['id']
            ];
        }
        return Db::table('shenbei_project_information')->insertAll($data);
    }

    //公有房产信息表
    public function HoursInfoTable($dataList)
    {
        $data = [];
        $userInfo = getLoginInfo();
        foreach ($dataList as $key => $val) {
            $data[] = ['units_name' => $val['units_name'],
                'units_nature' => empty($val['units_nature']) ? '' : $val['units_nature'],
                'units_legal' => empty($val['units_legal']) ? '' : $val['units_legal'],
                'legal_idcard' => $val['legal_idcard'],
                'preparer_name' => empty($val['preparer_name']) ? '' : $val['preparer_name'],
                'preparer_phone' => $val['preparer_phone'],
                'gyfc_address' => empty($val['gyfc_address']) ? '' : $val['gyfc_address'],
                'fc_nature' => empty($val['fc_nature']) ? '' : $val['fc_nature'],
                'fc_source' => empty($val['fc_source']) ? '' : $val['fc_source'],
                'fc_state' => empty($val['fc_state']) ? '' : $val['fc_state'],
                'fc_use' => empty($val['fc_use']) ? '' : $val['fc_use'],
                'water_number' => empty($val['water_number']) ? '' : $val['water_number'],
                'energy_number' => empty($val['energy_number']) ? '' : $val['energy_number'],
                'fc_district' => empty($val['fc_district']) ? '' : $val['fc_district'],
                'fc_deed' => empty($val['fc_deed']) ? '' : $val['fc_deed'],
                'deed_number' => empty($val['deed_number']) ? '' : $val['deed_number'],
                'deed_affiliation' => empty($val['deed_affiliation']) ? '' : $val['deed_affiliation'],
                'fc_area' => empty($val['fc_area']) ? '' : $val['fc_area'],
                'oneself_area' => empty($val['oneself_area']) ? '' : $val['oneself_area'],
                'loan_area' => empty($val['loan_area']) ? '' : $val['loan_area'],
                'lease_area' => empty($val['lease_area']) ? '' : $val['lease_area'],
                'unused_area' => empty($val['unused_area']) ? '' : $val['unused_area'],
                'other_area' => empty($val['other_area']) ? '' : $val['other_area'],
                'lease_name' => empty($val['lease_name']) ? '' : $val['lease_name'],
                'lease_idcard' => $val['lease_idcard'],
                'tenantry_type' => empty($val['tenantry_type']) ? '' : $val['tenantry_type'],
                'tenantry_name' => empty($val['tenantry_name']) ? '' : $val['tenantry_name'],
                'tenantry_idcard' => empty($val['tenantry_idcard']) ? '' : $val['tenantry_idcard'],
                'tenantry_phone' => empty($val['tenantry_phone']) ? '' : $val['tenantry_phone'],
                'tenantry_address' => empty($val['tenantry_address']) ? '' : $val['tenantry_address'],
                'lease_begintime' => $val['lease_begintime'],
                'lease_endtime' => $val['lease_endtime'],
                'zl_contract' => empty($val['zl_contract']) ? '' : $val['zl_contract'],
                'tjczba' => empty($val['tjczba']) ? '' : $val['tjczba'],
                'money_rent' => empty($val['money_rent']) ? '' : $val['money_rent'],
                'lease_months' => empty($val['lease_months']) ? '' : $val['lease_months'],
                'should_rent' => empty($val['should_rent']) ? '' : $val['should_rent'],
                'practical_rent' => empty($val['practical_rent']) ? '' : $val['practical_rent'],
                'ysws_rent' => empty($val['ysws_rent']) ? '' : $val['ysws_rent'],
                'ysws_cause' => empty($val['ysws_cause']) ? '' : $val['ysws_cause'],
                'paid_money' => empty($val['paid_money']) ? '' : $val['paid_money'],
                'account_yzc' => empty($val['account_yzc']) ? '' : $val['account_yzc'],
                'zc_type' => empty($val['zc_type']) ? '' : $val['zc_type'],
                'account_wzc' => empty($val['account_wzc']) ? '' : $val['account_wzc'],
                'account_wrz' => empty($val['account_wrz']) ? '' : $val['account_wrz'],
                'lender_name' => empty($val['lender_name']) ? '' : $val['lender_name'],
                'lender_idcard' => $val['lender_idcard'],
                'cjf_type' => empty($val['cjf_type']) ? '' : $val['cjf_type'],
                'cjf_name' => empty($val['cjf_name']) ? '' : $val['cjf_name'],
                'cjf_idcard' => empty($val['cjf_idcard']) ? '' : $val['cjf_idcard'],
                'cjf_phone' => empty($val['cjf_phone']) ? '' : $val['cjf_phone'],
                'cjf_address' => empty($val['cjf_address']) ? '' : $val['cjf_address'],
                'lend_begintime' => $val['lend_begintime'],
                'lend_endtime' => $val['lend_endtime'],
                'rekarks' => empty($val['rekarks']) ? '' : $val['rekarks'],
                'create_time' => toDate(time()),
                'create_by' => $userInfo['id']
            ];
        }
        return Db::table('shenbei_materials_house')->insertAll($data);

    }

    //物资数据-公务用车及特种车辆信息表
    public function CarInfoTable($dataList)
    {
        $data = [];
        $userInfo = getLoginInfo();
        foreach ($dataList as $key => $val) {
            $data[] = ['car_units' => $val['car_units'],
                'brand_type' => empty($val['brand_type']) ? '' : $val['brand_type'],
                'color' => empty($val['color']) ? '' : $val['color'],
                'license_number' => empty($val['license_number']) ? '' : $val['license_number'],
                'car_type' => empty($val['car_type']) ? '' : $val['car_type'],
                'carframe_number' => empty($val['carframe_number']) ? '' : $val['carframe_number'],
                'engine_number' => empty($val['engine_number']) ? '' : $val['engine_number'],
                'register_date' => empty($val['register_date']) ? '' : $val['register_date'],
                'travel_mileage' => empty($val['travel_mileage']) ? '' : $val['travel_mileage'],
                'gas_displacement' => empty($val['gas_displacement']) ? '' : $val['gas_displacement'],
                'money' => empty($val['money']) ? '' : $val['money'],
                'use_nature' => empty($val['use_nature']) ? '' : $val['use_nature'],
                'rekarks' => empty($val['rekarks']) ? '' : $val['rekarks'],
                'create_time' => toDate(time()),
                'create_by' => $userInfo['id']
            ];
        }
        return Db::table('shenbei_materials_car')->insertAll($data);
    }

//权力数据-中国共产党党员基本信息表
    public function dannyInfoTable($dataList)
    {
        $data = [];
        $userInfo = getLoginInfo();
        foreach ($dataList as $key => $val) {
            $data[] = ['name' => $val['name'],
                'idcard' => $val['idcard'],
                'sex' => empty($val['sex']) ? '' : $val['sex'],
                'nation' => empty($val['nation']) ? '' : $val['nation'],
                'nation_place' => empty($val['nation_place']) ? '' : $val['nation_place'],
                'birthdate' => $val['birthdate'],
                'education' => empty($val['education']) ? '' : $val['education'],
                'type' => empty($val['type']) ? '' : $val['type'],
                'organization' => empty($val['organization']) ? '' : $val['organization'],
                'party_date' => $val['party_date'],
                'zz_date' => $val['zz_date'],
                'station' => empty($val['station']) ? '' : $val['station'],
                'address' => empty($val['address']) ? '' : $val['address'],
                'mobile' => $val['mobile'],
                'phone' => empty($val['phone']) ? '' : $val['phone'],
                'da_units' => empty($val['da_units']) ? '' : $val['da_units'],
                'position' => empty($val['position']) ? '' : $val['position'],
                'stratum_type' => empty($val['stratum_type']) ? '' : $val['stratum_type'],
                'condition' => empty($val['condition']) ? '' : $val['condition'],
                'peasant' => empty($val['peasant']) ? '' : $val['peasant'],
                'missing_party' => empty($val['missing_party']) ? '' : $val['missing_party'],
                'missing_date' => $val['missing_date'],
                'flow_party' => empty($val['flow_party']) ? '' : $val['flow_party'],
                'information_integrity' => empty($val['information_integrity']) ? '' : $val['information_integrity'],
                'create_time' => toDate(time()),
                'create_by' => $userInfo['id']
            ];
        }
        return Db::table('shenbei_right_party_info')->insertAll($data);
    }

    //权力数据-监察对象六类人员基本信息表
    public function SupervisionTable($dataList)
    {
        $data = [];
        $userInfo = getLoginInfo();
        foreach ($dataList as $key => $val) {
            $data[] = ['units' => $val['units'],
                'units_name' => empty($val['units_name']) ? '' : $val['units_name'],
                'department' => empty($val['department']) ? '' : $val['department'],
                'name' => empty($val['name']) ? '' : $val['name'],
                'idcard' => $val['idcard'],
                'sex' => empty($val['sex']) ? '' : $val['sex'],
                'birthdate' => $val['birthdate'],
                'nation' => empty($val['nation']) ? '' : $val['nation'],
                'education' => empty($val['education']) ? '' : $val['education'],
                'mobile' => $val['mobile'],
                'work_date' => $val['work_date'],
                'duty' => empty($val['duty']) ? '' : $val['duty'],
                'duty_rank' => empty($val['duty_rank']) ? '' : $val['duty_rank'],
                'duty_zf_type' => empty($val['duty_zf_type']) ? '' : $val['duty_zf_type'],
                'bz_type' => empty($val['bz_type']) ? '' : $val['bz_type'],
                'supervise_type' => empty($val['supervise_type']) ? '' : $val['supervise_type'],
                'create_time' => toDate(time()),
                'create_by' => $userInfo['id']
            ];
        }
        return Db::table('shenbei_right_supervise_info')->insertAll($data);
    }

    //权力数据-部门权责清单表
    public function DepartmentTable($dataList)
    {
        $data = [];
        $userInfo = getLoginInfo();
        foreach ($dataList as $key => $val) {
            $data[] = ['authority_number' => $val['authority_number'],
                'authority_type' => empty($val['authority_type']) ? '' : $val['authority_type'],
                'authority_name' => empty($val['authority_name']) ? '' : $val['authority_name'],
                'subitem_name' => empty($val['subitem_name']) ? '' : $val['subitem_name'],
                'authority_gist' => $val['authority_gist'],
                'duty_matter' => empty($val['duty_matter']) ? '' : $val['duty_matter'],
                'subject_units' => empty($val['subject_units']) ? '' : $val['subject_units'],
                'subject_name' => empty($val['subject_name']) ? '' : $val['subject_name'],
                'subject_idcard' => $val['subject_idcard'],
                'subject_department' => empty($val['subject_department']) ? '' : $val['subject_department'],
                'department_name' => empty($val['department_name']) ? '' : $val['department_name'],
                'department_idcard' => $val['department_idcard'],
                'department_phone' => empty($val['department_phone']) ? '' : $val['department_phone'],
                'rekarks' => empty($val['rekarks']) ? '' : $val['rekarks'],
                'create_time' => toDate(time()),
                'create_by' => $userInfo['id']
            ];
        }
        return Db::table('shenbei_right_department')->insertAll($data);
    }

    //导入多条数据接口
    public function importData(Request $request)
    {
        $param = $request::param();
        $type = $param['type'];
        $dataList = $param['dataList'];
        $ret = [];
        switch ($type) {
            case 'zjsj_gcxm_zj':
                $ret = $this->projectBiao($dataList);
                break;
            case 'zjsj_dwbt_zj':
                $ret = $this->subsidyGeneralTable($dataList);
                break;
            case 'zjsj_dwbt_zjmx':
                $ret = $this->subsidyDetailedTable($dataList);
                break;
            case 'xmsj_xmjb':
                $ret = $this->projectBasicsTable($dataList);
                break;
            case 'wzsj_gyfc':
                $ret = $this->HoursInfoTable($dataList);
                break;
            case 'wzsj_gwyc_cl':
                $ret = $this->CarInfoTable($dataList);
                break;
            case 'qlsj_zggcd_dyx':
                $ret = $this->dannyInfoTable($dataList);
                break;
            case 'qlsj_jcdx':
                $ret = $this->SupervisionTable($dataList);
                break;
            case 'qlsj_bmqz':
                $ret = $this->DepartmentTable($dataList);
                break;

        }
        if ($ret != false) {
            return $this->returnJson(1001, '保存成功', $ret);
        } else {
            return $this->returnJson(1002, '保存失败');
        }

    }

    //查询表接口分页
    public function getDataTableListPage(Request $request)
    {
        $param = $request::param();
        $startTime = $request::param('start_time', '');
        $endTime = $request::param('end_time', '');
        $type = $param['type'];
        $pageSize = $param['pageSize'];
        $tableName = '';
        $userInfo = getLoginInfo();
        $where = [];
        if ($userInfo['id'] !== 'admin') {
            $where[] = ['create_by', '=', $userInfo['id']];
        }
        if ($startTime !== '' || $endTime !== '') {
            $where[] = ['create_time', '>=', $startTime];
            $where[] = ['create_time', '<=', $endTime];
        }
        $r1m = new ResourceModel();
        switch ($type) {
            case 'zjsj_gcxm_zj':
                $tableName = 'shenbei_fund_project';
                break;
            case 'zjsj_dwbt_zj':
                $tableName = 'shenbei_fund_subsidy';
                break;
            case 'zjsj_dwbt_zjmx':
                $tableName = 'shenbei_fund_subsidy_detail';
                break;
            case 'xmsj_xmjb':
                $tableName = 'shenbei_project_information';
                break;
            case 'wzsj_gyfc':
                $tableName = 'shenbei_materials_house';
                break;
            case 'wzsj_gwyc_cl':
                $tableName = 'shenbei_materials_car';
                break;
            case 'qlsj_zggcd_dyx':
                $tableName = 'shenbei_right_party_info';
                break;
            case 'qlsj_jcdx':
                $tableName = 'shenbei_right_supervise_info';
                break;
            case 'qlsj_bmqz':
                $tableName = 'shenbei_right_department';
                break;

        }
        $list = $r1m->table($tableName)
            ->where('del_flag', 0)
            ->where($where)
            ->order('create_time', 'desc')
            ->paginate($pageSize)
            ->toArray();
        if ($list != false) {
            return $this->returnJson(1001, '返回数据成功', $list);
        } else {
            return $this->returnJson(1002, '返回数据失败');
        }
    }

    //删除接口
    public function deleteDataTable(Request $request)
    {
        $param = $request::param();
        $type = $param['type'];
        $id = $param['id'];
        $userInfo = getLoginInfo();
        $list = [];
        switch ($type) {
            case 'zjsj_gcxm_zj':
                $list = Db::table('shenbei_fund_project')->where('id', $id)
                    ->update(['del_flag' => 1, 'create_time' => toDate(time()), 'create_by' => $userInfo['id']]);
                break;
            case 'zjsj_dwbt_zj':
                $list = Db::table('shenbei_fund_subsidy')
                    ->where('id', $id)->update(['del_flag' => 1, 'create_time' => toDate(time()), 'create_by' => $userInfo['id']]);
                break;
            case 'zjsj_dwbt_zjmx':
                $list = Db::table('shenbei_fund_subsidy_detail')
                    ->where('id', $id)->update(['del_flag' => 1, 'create_time' => toDate(time()), 'create_by' => $userInfo['id']]);
                break;
            case 'xmsj_xmjb':
                $list = Db::table('shenbei_project_information')
                    ->where('id', $id)->update(['del_flag' => 1, 'create_time' => toDate(time()), 'create_by' => $userInfo['id']]);
                break;
            case 'wzsj_gyfc':
                $list = Db::table('shenbei_materials_house')
                    ->where('id', $id)->update(['del_flag' => 1, 'create_time' => toDate(time()), 'create_by' => $userInfo['id']]);
                break;
            case 'wzsj_gwyc_cl':
                $list = Db::table('shenbei_materials_car')
                    ->where('id', $id)->update(['del_flag' => 1, 'create_time' => toDate(time()), 'create_by' => $userInfo['id']]);
                break;
            case 'qlsj_zggcd_dyx':
                $list = Db::table('shenbei_right_party_info')
                    ->where('id', $id)->update(['del_flag' => 1, 'create_time' => toDate(time()), 'create_by' => $userInfo['id']]);
                break;
            case 'qlsj_jcdx':
                $list = Db::table('shenbei_right_supervise_info')
                    ->where('id', $id)->update(['del_flag' => 1, 'create_time' => toDate(time()), 'create_by' => $userInfo['id']]);
                break;
            case 'qlsj_bmqz':
                $list = Db::table('shenbei_right_department')
                    ->where('id', $id)->update(['del_flag' => 1, 'create_time' => toDate(time()), 'create_by' => $userInfo['id']]);
                break;
        }
        if ($list != false) {
            return $this->returnJson(1001, '删除成功', $list);
        } else {
            return $this->returnJson(1002, '删除失败');
        }

    }

    //批量删除
    public function deleteAllDataTable(Request $request)
    {
        $param = $request::param();
        $type = $param['type'];
        $id = $param['ids'];
        $userInfo = getLoginInfo();
        $list = [];
        switch ($type) {
            case 'zjsj_gcxm_zj':
                $list = Db::table('shenbei_fund_project')->whereIn('id', json_decode($id))->update(['del_flag' => 1]);
                break;
            case 'zjsj_dwbt_zj':
                $list = Db::table('shenbei_fund_subsidy')
                    ->whereIn('id', json_decode($id))->update(['del_flag' => 1, 'create_time' => toDate(time()), 'create_by' => $userInfo['id']]);
                break;
            case 'zjsj_dwbt_zjmx':
                $list = Db::table('shenbei_fund_subsidy_detail')
                    ->whereIn('id', json_decode($id))->update(['del_flag' => 1, 'create_time' => toDate(time()), 'create_by' => $userInfo['id']]);
                break;
            case 'xmsj_xmjb':
                $list = Db::table('shenbei_project_information')
                    ->whereIn('id', json_decode($id))->update(['del_flag' => 1, 'create_time' => toDate(time()), 'create_by' => $userInfo['id']]);
                break;
            case 'wzsj_gyfc':
                $list = Db::table('shenbei_materials_house')
                    ->whereIn('id', json_decode($id))->update(['del_flag' => 1, 'create_time' => toDate(time()), 'create_by' => $userInfo['id']]);
                break;
            case 'wzsj_gwyc_cl':
                $list = Db::table('shenbei_materials_car')
                    ->whereIn('id', json_decode($id))->update(['del_flag' => 1, 'create_time' => toDate(time()), 'create_by' => $userInfo['id']]);
                break;
            case 'qlsj_zggcd_dyx':
                $list = Db::table('shenbei_right_party_info')
                    ->whereIn('id', json_decode($id))->update(['del_flag' => 1, 'create_time' => toDate(time()), 'create_by' => $userInfo['id']]);
                break;
            case 'qlsj_jcdx':
                $list = Db::table('shenbei_right_supervise_info')
                    ->whereIn('id', json_decode($id))->update(['del_flag' => 1, 'create_time' => toDate(time()), 'create_by' => $userInfo['id']]);
                break;
            case 'qlsj_bmqz':
                $list = Db::table('shenbei_right_department')
                    ->whereIn('id', json_decode($id))->update(['del_flag' => 1, 'create_time' => toDate(time()), 'create_by' => $userInfo['id']]);
                break;
        }
        if ($list != false) {
            return $this->returnJson(1001, '删除成功', $list);
        } else {
            return $this->returnJson(1002, '删除失败');
        }
    }
}
